ctype_lower
检查小写字符
适用PHP版本:PHP 4, PHP 5, PHP 7, PHP 8
函数说明:此函数用于检查一个字符串是否仅由小写字母组成。如果字符串中的每个字符都是小写字母,则返回 true,否则返回 false。
函数语法:ctype_lower(string $text): bool
参数:
返回值:如果字符串中的每个字符都是小写字母,返回 true;否则返回 false。
示例:
<?php $str1 = "hello"; $str2 = "Hello"; $str3 = "123"; <p>echo ctype_lower($str1); // 输出:1 (true)<br> echo ctype_lower($str2); // 输出: 空 (false)<br> echo ctype_lower($str3); // 输出: 空 (false)<br> ?><br>
示例代码的说明:
在上面的示例中,使用 ctype_lower 函数检查三个字符串: